package com.yhy.manager.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yhy.manager.domain.AnalysisByDay;
import com.yhy.manager.domain.AnalysisUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {


    @Select("SELECT sum(num_active) FROM tb_analysis_by_day WHERE record_date > #{lastMonth};")
    Integer queryActivePassMonth(String lastMonth);

    @Select("SELECT sum(num_active) FROM tb_analysis_by_day WHERE record_date > #{lastMonth};")
    Integer queryActivePassWeek(String lastMonth);

    @Select("SELECT IFNULL(SUM(#{typeStr}),0) FROM tb_analysis_by_day WHERE record_date #{date};")
    Long queryByMonthAndType(@Param("date") String date, @Param("typeStr") String typeStr);

//    @Select("SELECT * FROM tb_analysis_by_day ${ew.customSqlSegment}")
//    Long query101ByMonth(@Param(Constants.WRAPPER) Wrapper<AnalysisUser> analysisUserWrapper);

    List selectList(QueryWrapper<AnalysisUser> qw);
}
